#include<stdio.h>
int main() {
	int n, i;
	char c;
	double h;
	scanf_s("%d", &n);
	for (i = 0; i < n; i++) {
		getchar();
		scanf_s("%c%lf", &c, &h);
		if (c == 'M') {
			printf("%.2lf\n", 1.0 * h / 1.09);
		}
		else {
			printf("%.2lf\n", h * 1.09);
		}
	}
	return 0;
}
